package com.tensquare.comment.service;

import com.tensquare.comment.dao.CommentDao;
import com.tensquare.comment.pojo.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import util.IdWorker;

import java.util.List;

/**
 * 描述:
 *
 * @create 2019-12-31 16:26
 */
public class CommentService {

    @Autowired
    private CommentDao commentDao;

    @Autowired
    IdWorker idWorker;

    public void add(Comment comment) {
        comment.set_id(idWorker.nextId() + "");
        commentDao.save(comment);
    }

    public List<Comment> findByArticle(String articleid) {
        return commentDao.findByArticleid(articleid);
    }
}
